package com.softer.wxzj.controller;

import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.ExpProjectReq;
import com.softer.wxzj.entity.MaintainObjectSearch;
import com.softer.wxzj.service.MaintainObjectSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 维修对象查询
 *
 * @author Gong Zhiyang
 * @date 2019/8/9
 */
@RestController
@RequestMapping("/maintainObjectSearch")
public class MaintainObjectSearchController {

    @Autowired
    private MaintainObjectSearchService maintainObjectSearchService;

    /**
     * 根据维修对象ID查询维修项目列表
     *
     * @param page          分页实体
     * @param expProjectReq 查询实体
     * @return 维修项目列表
     */
    @PostMapping("/getProjectListByMaintenanceObjectId")
    public PageInfo<ExpProjectReq> getProjectListByMaintenanceObjectId(Page page, ExpProjectReq expProjectReq) {
        return maintainObjectSearchService.getProjectListByMaintenanceObjectId(page, expProjectReq);
    }

    /**
     * 维修对象查询列表
     *
     * @param page                 分页实体
     * @param maintainObjectSearch 查询实体
     * @return 维修对象查询列表
     */
    @PostMapping("/getList")
    public PageInfo<MaintainObjectSearch> getList(Page page, MaintainObjectSearch maintainObjectSearch) {
        return maintainObjectSearchService.getList(page, maintainObjectSearch);
    }
}
